﻿using LxBasic;
using LxCore;
using System;

namespace LxCore
{
    public abstract class FieldBase<T> : JsObject, IField<T>
    {
        public virtual ICellVarArr<T>? GetCellVarArr(IIndexHost indexHost)
        {
            return null;
        }
        public virtual IFaceVarArr<T>? GetFaceVarArr(IIndexHost indexHost)
        {
            return null;
        }
        public virtual bool IsParameter(out T value)
        {
            value = default;
            return false;
        }
        public bool IsEqual0()
        {
            if (IsParameter(out T value))
            {
                switch (value)
                {
                    case double d: return d == 0;
                    case Vector3d v: return v == Vector3d.Zero;
                    default: return false;
                }
            }
            return false;
        }

    }
}